const express = require("express");
const sampleVillageController = require("../controller/sampleVillageController");
const requireAuth = require("../middleware/requireAuth");
const router = express.Router({ mergeParams: true });

router
  .route("/")
  .post(requireAuth, sampleVillageController.createSampleVillage)
  .get(requireAuth, sampleVillageController.getSampleVillageByGroup);

router
  .route("/:id")
  .delete(requireAuth, sampleVillageController.deleteSampleVillage)
  .patch(requireAuth, sampleVillageController.updateSampleVillage);

router
  .route("/publish")
  .post(requireAuth, sampleVillageController.publishSampleVillageByGroup) //发布样本村
  .get(requireAuth, sampleVillageController.getPublishedSampleVillageByGroup); //获取正在发布的样本村

module.exports = router;
